When a data item is stored in a single database or data store that is accessible over a network, it is often the case that multiple servers or clients will require access to that data item. Traditionally, this requires data be read from the database each time the data item is accessed. Each read from the database is relatively resource intensive and may be relatively inefficient.
One way of overcoming some of the efficiency and scalability problems, associated with requiring a server or client to read from the database each time a data item is to be accessed, is to store the data item in cache memory. In this way, once a server or client has read a data item from the database it may simply store a copy of that item in a local cache. That local copy of the data item can then be used if future access is needed. This process may be appropriate and efficient for data items that never change, but problems arise when a data item is updated in the database.
If a data item stored in the database is updated, a copy of that data item stored in a local cache on the network may be different from the item in the database, as it will not automatically receive the update. The problem intensifies when there are multiple local copies on different servers and/or clients on the network. Since each of these local copies is created at a different time, there can be multiple versions of the data item on the network. If a user tries to update or view the data item, the copy accessed by the user may not be current and/or correct.
These problems with concurrency can have drastic consequences, such as for example when a user accesses a data item showing a bank account balance. If the local copy of the bank account balance has not been updated to show a withdrawal, for example, the bank account balance shown to the user may in fact show an incorrectly large balance. This could lead the user to unknowingly overdraw the account. Further, a third party accessing the account balance, or a device such as an ATM, would have no way of knowing that the balance being shown is incorrect.